package com.week2.zuhe;

public class MyRectangle 
{
	private MyPoint leftUpperPoint;
	private MyPoint rightLowerPoint;
	public MyRectangle(int x1,int y1,int x2,int y2)
	{
		leftUpperPoint = new MyPoint(x1,y1);
		rightLowerPoint = new MyPoint(x2,y2);
	}
	public MyRectangle(MyPoint leftUpperPoint,MyPoint rightLowerPoint)
	{
		this.leftUpperPoint = leftUpperPoint;
		this.rightLowerPoint = rightLowerPoint;
	}
	public double getDiagonal()
	{

		return leftUpperPoint.distance(rightLowerPoint);

	}
	public double getPerimeter()
	{
		double a = Math.abs(leftUpperPoint.getX()-rightLowerPoint.getX());
		double b = Math.abs(leftUpperPoint.getY()-rightLowerPoint.getY());
		return a*2+b*2;
	}
	

}
